package com.kede.dictenum;

import com.kede.annotation.DictEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;

/***
 ** @Author:Pr.li
 ** @Description:
 ** @Date: create in 2023/5/12 12:07
 ***/
@Getter
@AllArgsConstructor
public enum OrderStatusDictEnum implements DictEnum {
//    UNKNOEW(-3,"异常订单"),
//    REFUSE(-2,"驳回"),
//    CANCEL(-1,"取消订单"),
//    NOPAY(0,"未支付"),
//    PAY(1,"已支付"),
//    SEND(2,"已发货"),
//    RECEIVE(3,"已签收"),
//    REGOODING(4,"退货中"),
//    RERUND(5,"已退款");

    NOPAY(1,"待付款",1),
    SEND(2,"待发货",2),
    RECEIVEING(3,"待收货",3),
    RECEIVE(4,"已签收",4),
    OFFLINERECEIVE(5,"待领取",5), //线下单 支付后 出现的状态
    RETURN(6,"申请退货",6),
    RETURNED(7,"退货中",7),
    RETURNMONEY(8,"退款中",8),
    FINISH(99,"已完成",9),
    CANCEL(100,"已取消",10);


    private Integer code;
    private String value;
    private Integer enumIndex;

    @Override
    public String getLabelStr() {
        return value;
    }

    @Override
    public String getValueStr() {
        return code.toString();
    }

    @Override
    public String getName() {
        return "order_status";
    }

    @Override
    public String getDes() {
        return "订单状态";
    }

    public static OrderStatusDictEnum valueOfCode(Integer code) {
        for (OrderStatusDictEnum it : OrderStatusDictEnum.values()) {
            if (it.getCode().equals(code)) {
                return it;
            }
        }
        return null;
    }
}
